package com.glink.manage.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.glink.common.exception.GeneralSimpleException;
import com.glink.manage.domain.AttachmentImageBean;
import com.glink.manage.dto.upload.*;
import com.glink.manage.vo.upload.AttachmentAppVO;
import com.glink.manage.vo.upload.AttachmentImageUploadVO;
import com.glink.manage.vo.upload.AttachmentImageVO;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.util.List;
import java.util.Map;

/**
 * Created by IntelliJ IDEA.
 *
 * @Author : qiushaoshan
 * @create 2024/7/5 13:02
 */
public interface AttachmentService extends IService<AttachmentImageBean> {
    
    /**
     * 根据图片ID查询图片信息
     * @param idDTO
     */
    AttachmentImageVO findImageById(UploadImageIdDTO idDTO) throws GeneralSimpleException;
 

    List<String> onlyUploadStaticImages(UploadImageListDTO dto, String userId) throws GeneralSimpleException;

    /**
     * 上传文件
     * @param file 文件信息
     * @param orgId 组织机构
     * @param modelType 模型类型
     * @return 图片信息
     * @throws GeneralSimpleException 异常
     */
    AttachmentImageBean uploadImage(File file, String orgId, String modelType) throws GeneralSimpleException;
    AttachmentImageBean uploadImage(MultipartFile file, String orgId, String modelType) throws GeneralSimpleException;
    
    /**
     * 根据图片ID查询图片
     * @param imageId 图片ID
     * @param httpServletResponse HTTP
     */
    void exportStaticFile(String imageId, String type, HttpServletResponse httpServletResponse);

    /**
     * 
     * @param dto
     * @param userId
     * @return
     */
    String onlyUploadStaticImagesOne(UploadImageDTO dto, String userId) throws GeneralSimpleException;

    /**
     * 根据图片ID获取图片信息
     * @param imageId 图片ID
     * @return 图片信息
     */
    byte[] getFileByte(String imageId);

    /**
     * 上传附件
     * @param dto 上传附件信息
     * @param userId 用户ID
     * @return 附件ID
     */
    AttachmentImageUploadVO onlyUploadStaticFile(UploadImageDTO dto, String userId) throws GeneralSimpleException;

    /**
     * 上传APP
     * @param dto 上传APP
     * @return 上传状态
     */
    Boolean uploadApp(UploadAppDTO dto) throws GeneralSimpleException;
    /**
     * 查询APP列表
     * @return app信息
     */
    AttachmentAppVO listByApp();

    /**
     * 根据图片ID查询静态文件访问路径
     * @param imageId 图片ID
     * @return 文件路径
     */
    String findStaticImagePath(String imageId);
    
    /**
     * 查询图片ID，校验是否存在
     *
     * @param imageIdList 图片ID
     * @return 图片ID
     */
    Map<String, String> findImageIdByImageIdIn(List<String> imageIdList);

    /**
     * 下载FTP图片
     * @param dto 文件路径
     * @param response 返回数据
     */
    void downloadPicByFtp(UploadFilePathDTO dto, HttpServletResponse response);
    void downloadPicByFtp(String path, HttpServletResponse response);

    /**
     * base64转image
     * @param base64Image base64
     * @return 生成状态
     */
    String decodeBase64ToImage(String base64Image, String objId, String orgId);

    /**
     * 删除APP
     * @param dto 删除条件
     * @return 删除状态
     */
    Boolean delApp(UploadAppDelDTO dto);
}
